ostbuild: Adapt "build" to newly updated expanded manifest
authorColin Walters <walters@verbum.org>
Sun, 4 Mar 2012 17:59:17 +0000 (12:59 -0500)
committerColin Walters <walters@verbum.org>
Tue, 13 Mar 2012 14:39:25 +0000 (10:39 -0400)
src/ostbuild/pyostbuild/builtin_build.py
src/ostbuild/pyostbuild/builtin_resolve.py

index 07bea3927983be2b993f234ba996759179172775..247fa07685f25cf5e0e1224d944d8601923fd75a 100755 (executable)
@@ -165,7 +165,6 @@ class OstbuildBuild(builtins.Builtin):
 
         args = ['ostree', '--repo=' + self.repo,
                 'commit', '-b', buildname, '-s', 'Build',
-                '--add-metadata-string=ostbuild-name=' + artifact_meta['name'],
                 '--add-metadata-string=ostbuild-revision=' + artifact_meta['revision'],
                 '--owner-uid=0', '--owner-gid=0', '--no-xattrs', 
                 '--skip-if-unchanged']
@@ -187,30 +186,35 @@ class OstbuildBuild(builtins.Builtin):
             os.unlink(statoverride_path)
         return True
 
-    def _compose_arch(self, architecture, components):
-        runtime_base = buildutil.manifest_base(self.manifest, 'runtime', architecture)
-        devel_base = buildutil.manifest_base(self.manifest, 'devel', architecture)
-        runtime_contents = [runtime_base + ':/']
-        devel_contents = [devel_base + ':/']
+    def _compose(self, components):
+        base_ref = 'bases/%s:/' % (self.manifest['base'], )
+        contents = [base_ref]
+
+        # HACK
+        manifest_build_name = self.manifest['name']
+        is_runtime = manifest_build_name.endswith('-runtime')
+        # HACK - we should really name builds just like e.g. gnomeos-3.4-i686 
+        if is_runtime:
+            manifest_build_name = manifest_build_name[:-len('-runtime')] + '-devel'
 
         for component in components:
-            branch = buildutil.manifest_buildname(self.manifest, component, architecture)
-            runtime_contents.append(branch + ':/runtime')
-            devel_contents.append(branch + ':/runtime')
-            # For now just hardcode docs going in devel
-            devel_contents.append(branch + ':/doc')
-            devel_contents.append(branch + ':/devel')
-
-        buildutil.compose(self.repo, '%s-%s-%s' % (self.manifest['name'], architecture, 'runtime'),
-                          runtime_contents)
-        buildutil.compose(self.repo, '%s-%s-%s' % (self.manifest['name'], architecture, 'devel'),
-                          devel_contents)
+            branch = 'artifacts/%s/%s/%s' % (manifest_build_name,
+                                             component['name'],
+                                             component['branch'])
+            contents.append(branch + ':/runtime')
+            if not is_runtime:
+                # For now just hardcode docs going in devel
+                contents.append(branch + ':/doc')
+                contents.append(branch + ':/devel')
+
+        buildutil.compose(self.repo, self.manifest['name'], contents)
     
     def execute(self, argv):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--skip-built', action='store_true')
         parser.add_argument('--recompose', action='store_true')
         parser.add_argument('--start-at')
+        parser.add_argument('--manifest', required=True)
         parser.add_argument('--shell-on-failure', action='store_true')
         parser.add_argument('--debug-shell', action='store_true')
         parser.add_argument('components', nargs='*')
@@ -224,8 +228,7 @@ class OstbuildBuild(builtins.Builtin):
         self.buildopts.shell_on_failure = args.shell_on_failure
         self.buildopts.skip_built = args.skip_built
 
-        build_manifest_path = os.path.join(self.workdir, 'snapshot.json')
-        self.manifest = json.load(open(build_manifest_path))
+        self.manifest = json.load(open(args.manifest))
 
         components = self.manifest['components']
         if args.recompose:
@@ -259,10 +262,8 @@ class OstbuildBuild(builtins.Builtin):
 
         for component in build_components[start_at_index:]:
             index = components.index(component)
-            for architecture in self.manifest['architectures']:
-                self._build_one_component(component, architecture)
+            self._build_one_component(component)
 
-        for architecture in self.manifest['architectures']:
-            self._compose_arch(architecture, components)
+        self._compose(components)
         
 builtins.register(OstbuildBuild)
index 8080c4b1bd5bc821e26fc0d4170440bcfc9bdbe9..e7f5ece9576a32439a015cb6f4d1b136257a11c6 100755 (executable)
@@ -234,9 +234,10 @@ class OstbuildResolve(builtins.Builtin):
                 else:
                     snapshot['components'] = devel_components
 
-                snapshot_name = '%s-%s-%s.snapshot' % (arch_manifest['name'], architecture, component_type)
-                snapshot['name'] = snapshot_name
-                out_snapshot = os.path.join(self.workdir, snapshot_name)
+                snapshot['name'] = '%s-%s-%s' % (arch_manifest['name'], architecture, component_type)
+                snapshot_base = snapshot['base']
+                snapshot['base'] = snapshot_base + '-%s-%s' % (architecture, component_type)
+                out_snapshot = os.path.join(self.workdir, snapshot['name'] + '.snapshot')
                 f = open(out_snapshot, 'w')
                 json.dump(snapshot, f, indent=4, sort_keys=True)
                 f.close()